home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / presto / prest1_0.lha / Tests / sos / set.h < prev    next >
C/C++ Source or Header  |  1991-12-11  |  508b  |  29 lines

  1.  
  2. //
  3. // A "set" is a representation for a set of elements drawn from
  4. // a collection of 128 elements (integers 0-127).
  5. //
  6. // The implementation is pretty sick.  The number 128 is basically
  7. // hardcoded, and it is assumed that "unsigned" has 32 bits.
  8. //
  9.  
  10. #define MAXSIZE 128
  11.  
  12. class Set: public Object {
  13.     unsigned s_members[4];
  14.     int s_total;
  15. public:
  16.     Set();
  17.     ~Set();
  18.     Set *clone();
  19.     void include(int m);
  20.     void remove(int m);
  21.     int ismember(int e);
  22.     int sum()
  23.         { return s_total; }
  24.     void print(ostream &s);
  25. };
  26.  
  27.  
  28.  
  29.